@im-nobsidian/core 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -246,6 +246,8 @@ interface SyncRecord {
246
246
  readonly fileType: FileType;
247
247
  readonly status: SyncStatus;
248
248
  readonly baseSnapshot: Buffer | null;
249
+ readonly localMtime: string | null;
250
+ readonly localFileSize: number | null;
249
251
  readonly version: number;
250
252
  readonly createdAt: string;
251
253
  readonly updatedAt: string;
@@ -279,6 +281,7 @@ interface ProgressItem {
279
281
  type ProgressCallback = (current: number, total: number, item: ProgressItem) => void;
280
282
  interface PushOptions {
281
283
  readonly paths?: string[];
284
+ readonly excludePaths?: string[];
282
285
  readonly force?: boolean;
283
286
  readonly dryRun?: boolean;
284
287
  readonly onProgress?: ProgressCallback;
@@ -475,6 +478,7 @@ declare class StateDB {
475
478
  updateStatus(id: string, status: SyncStatus): void;
476
479
  updateHash(id: string, hash: string, snapshot?: Buffer | null): void;
477
480
  setNotionLastEdited(id: string, lastEdited: string): void;
481
+ updateStatCache(id: string, mtime: string, fileSize: number): void;
478
482
  setNotionParentId(id: string, parentId: string): void;
479
483
  delete(id: string): void;
480
484
  resolveWikilink(text: string): WikilinkEntry | null;
@@ -505,6 +509,8 @@ interface UpsertSyncRecord {
505
509
  readonly fileType: SyncRecord["fileType"];
506
510
  readonly status: SyncRecord["status"];
507
511
  readonly baseSnapshot?: Buffer | null;
512
+ readonly localMtime?: string | null;
513
+ readonly localFileSize?: number | null;
508
514
  }
509
515
  interface FileRegistryEntry {
510
516
  readonly id: string;
@@ -604,6 +610,10 @@ declare class NotionClient {
604
610
  results: PageObjectResponse[];
605
611
  nextCursor: string | null;
606
612
  }>;
613
+ searchRecentPages(since: string): Promise<Array<{
614
+ id: string;
615
+ last_edited_time: string;
616
+ }>>;
607
617
  getChildPages(parentId: string): Promise<PageObjectResponse[]>;
608
618
  getChildDatabaseIds(parentId: string): Promise<string[]>;
609
619
  getChildPagesRecursive(parentId: string): Promise<PageObjectResponse[]>;
@@ -752,6 +762,7 @@ interface FileInfo {
752
762
  declare class ChangeDetector {
753
763
  private readonly stateDb;
754
764
  constructor(stateDb: StateDB);
765
+ detectLocalChangesFast(stats: FileStatInfo[], readFile: (path: string) => Promise<string>): Promise<LocalChange[]>;
755
766
  detectLocalChanges(currentFiles: FileInfo[]): LocalChange[];
756
767
  private detectMoves;
757
768
  }
@@ -761,6 +772,11 @@ interface NonMdFileInfo {
761
772
  readonly size: number;
762
773
  readonly mtime: string;
763
774
  }
775
+ interface FileStatInfo {
776
+ readonly path: string;
777
+ readonly mtime: string;
778
+ readonly size: number;
779
+ }
764
780
  interface VaultFS {
765
781
  readFile(path: string): Promise<string>;
766
782
  readBinary(path: string): Promise<Buffer>;
@@ -771,7 +787,9 @@ interface VaultFS {
771
787
  exists(path: string): Promise<boolean>;
772
788
  ensureFolder(path: string): Promise<void>;
773
789
  listMarkdownFiles(): Promise<FileInfo[]>;
790
+ listMarkdownFileStats(): Promise<FileStatInfo[]>;
774
791
  listNonMarkdownFiles(): Promise<NonMdFileInfo[]>;
792
+ getFileStat(path: string): Promise<FileStatInfo | null>;
775
793
  }
776
794
 
777
795
  declare class SyncOrchestrator {
@@ -794,9 +812,17 @@ declare class SyncOrchestrator {
794
812
  pull(options?: PullOptions): Promise<PullResult>;
795
813
  sync(options?: SyncOptions): Promise<SyncResult>;
796
814
  status(): Promise<StatusResult>;
815
+ statusLocal(): Promise<StatusResult>;
816
+ fetch(): Promise<{
817
+ newPages: number;
818
+ deletedPages: number;
819
+ modifiedPages: number;
820
+ duration: number;
821
+ }>;
797
822
  private buildConflictsFromRecords;
798
823
  private get isDatabaseMode();
799
824
  private discoverChildDatabases;
825
+ private pullDiscoveredDatabases;
800
826
  private resolveNotionLinks;
801
827
  private ensureDbSchema;
802
828
  private pushCreate;
@@ -804,16 +830,18 @@ declare class SyncOrchestrator {
804
830
  private pushDelete;
805
831
  private pushMove;
806
832
  private detectRemoteChanges;
833
+ private detectRemoteChangesIncremental;
834
+ private isTrackedParent;
807
835
  private pullCreate;
808
836
  private pullUpdate;
809
837
  private pullDelete;
810
838
  private ensureFolderPage;
811
839
  private resolveNotionParent;
840
+ private repairFolderRecords;
812
841
  private isFolderNote;
813
842
  private resolveParentPath;
814
843
  private pushCreatePage;
815
844
  private pushUpdatePage;
816
- private computePatches;
817
845
  private fetchPageMarkdown;
818
846
  private extractParentId;
819
847
  private resolveBlockToPageId;
@@ -840,10 +868,13 @@ declare class NodeVaultFS implements VaultFS {
840
868
  exists(path: string): Promise<boolean>;
841
869
  ensureFolder(path: string): Promise<void>;
842
870
  listMarkdownFiles(): Promise<FileInfo[]>;
871
+ listMarkdownFileStats(): Promise<FileStatInfo[]>;
872
+ getFileStat(path: string): Promise<FileStatInfo | null>;
843
873
  listNonMarkdownFiles(): Promise<NonMdFileInfo[]>;
844
874
  private matchesPattern;
845
875
  private isExcluded;
846
876
  private walkDirNonMd;
877
+ private walkDirStats;
847
878
  private walkDir;
848
879
  }
849
880
 
@@ -1315,4 +1346,4 @@ interface PipelineOptions {
1315
1346
  }
1316
1347
  declare function createDefaultPipeline(options?: PipelineOptions): ConversionPipeline;
1317
1348
 
1318
- export { BlockConverter, type CalendarEntry, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DEFAULT_CONFIG, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, EmbedResolver, EntryEditor, type FailedOperation, type FileDownloadResult, FileHandler, type FileInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, type GroupByConfig, type GroupedEntries, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCover, type PageCreationPlan, type PageIcon, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, type ProgressItem, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, extractCalendarEntries, filterByMonth, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, sortEntries, threeWayMerge };
1349
+ export { BlockConverter, type CalendarEntry, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DEFAULT_CONFIG, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, EmbedResolver, EntryEditor, type FailedOperation, type FileDownloadResult, FileHandler, type FileInfo, type FileStatInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, type GroupByConfig, type GroupedEntries, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCover, type PageCreationPlan, type PageIcon, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, type ProgressItem, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, extractCalendarEntries, filterByMonth, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, sortEntries, threeWayMerge };